<template>
	<view class="">
		<view class="nav">
			<view :class="['nav_item',nav_index==index?'nav_item_item':'']" 
				v-for="(item,index) in navlist" 
				:key="index"
				@click="change(index)"
				>
				{{item}}
				<view class="line">
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:['navlist'],
		data () {
			return {
				nav_index:0
			}
		},
		methods: {
			change(key) {
				this.nav_index = key
				this.$emit('changenav',this.nav_index)
			}
		}
	}
</script>

<style lang="less" scoped>
	.nav {
		width: 100%;
		height: 80upx;
		border-bottom: 2upx solid #E1e1e1;
		display: flex;
		background-color: #FFFFFF;
		justify-content: space-around;
		.nav_item {
			// width: 100upx;
			height: 100%;
			font-size: 28upx;
			box-sizing:border-box;
			text-align: center;
			line-height: 80upx;
			color: #333333;
		}
		.nav_item_item {
			font-size: 32upx;
			color: #8938d2;
			font-weight: bold;
			position: relative;
			.line {
				position: absolute;
				width: 34upx;
				height: 4upx;
				background-color:#8938d2 ;
				bottom: 0;
				left: 50%;
				transform: translate(-50%);
			}
		}
	}
</style>
